package com.xjtu.chapter07.container;

import java.awt.*;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/8/19 16:39
 */
public class ScrollPanelDemo {
    public static void main(String[] args) {
        //1.创建Frame窗口对象
        Frame frame = new Frame("测试ScrollPane");

        //2.创建ScrollPane对象，并且指定默认有滚动条
        ScrollPane scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);

        //3.往ScrollPane中添加组件
        scrollPane.add(new TextField("测试文本"));
        scrollPane.add(new Button("测试按钮"));

        //4.把ScrollPane添加到Frame中
        frame.add(scrollPane);

        //5.设置Frame的位置及大小
        frame.setBounds(30,30,500,300);

        //6.设置Frame可见
        frame.setVisible(true);
    }
}
